class Student:
    def __init__(selfn, name, age):
        selfn.name = name
        selfn.age = age

    '''
    魔术方法
    '''

    # 返回字符串
    def __str__(self):
        return f"student类对象，name={self.name},age={self.age}"

    # 返回布尔值
    # 判断大于小于
    def __lt__(self, other):
        return self.age < other.age

    # 判断大于等于和小于等于
    def __le__(self, other):
        return self.age <= other.age


student1 = Student("张安", 18)
student2 = Student("李四", 20)
print(Student)
print(str(student1))
print(student1 < student2)
print(student1 > student2)
print(student1 <= student2)
print(student1 >= student2)
